<?php
// 打开要截取的图片
$bg = imageCreateFromjpeg('./bg.jpg');

$bg_w = imagesx($bg);

$bg_h = imagesy($bg);

$big = imageCreateTrueColor($bg_w*0.5,$bg_h*0.5); 

$mid = imageCreateTrueColor($bg_w*0.3,$bg_h*0.3);

$small = imageCreateTrueColor($bg_w*0.1,$bg_h*0.1); 

imagecopyresized ( $big ,$bg, 0 , 0 ,0 , 0 , $bg_w*0.5 ,  $bg_h*0.5 , $bg_w , $bg_h );

imagecopyresized ( $mid ,$bg, 0 , 0 ,0 , 0 , $bg_w*0.3 ,  $bg_h*0.3 , $bg_w , $bg_h );

imagecopyresized ( $small ,$bg, 0 , 0 ,0 , 0 , $bg_w*0.1 ,  $bg_h*0.1 , $bg_w , $bg_h );

imagepng($big,'./big_'.uniqid().".png");
imagepng($mid,'./mid_'.uniqid().".png");
imagepng($small,'./small_'.uniqid().".png");